package com.da.javatest.interview.other;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import org.apache.commons.lang3.StringUtils;

/**
 * @author chenlida
 * @date 2020/4/2 15:08
 * @description
 */
public class JsonParseTest {
    public static void main(String[] args) {
        String s = "{\"season\": \"0\", \"secret\": \"0\", \"fragile\": \"0\", \"pickup_sku\": \"1\", "
            + "\"packageSpec\": \"1\", \"series_config\": \"{\\\"hmDefaultSerialItem\\\":true,"
            + "\\\"hmSerialDesc\\\":\\\"多种口味选择\\\",\\\"hmSerialName\\\":\\\"星巴克拿铁预发(勿动)\\\","
            + "\\\"hmSerialNo\\\":\\\"11000007#1|4\\\"}\", \"major_pic_type\": 1, \"richTxtTicketNo\": "
            + "\"IRTM201809111004123\", \"merchantProductId\": 607671783177, \"richTxtAuditStatus\": 1, "
            + "\"merchant_cat_out_id\": \"200788012\"}";
        if (StringUtils.isNotBlank(s)) {
            JSONObject jsonObject = JSON.parseObject(s);
            JSONObject config = jsonObject.getJSONObject("series_config");
            if (config != null) {
                System.out.println(config.getString("hmSerialName"));
                System.out.println(config.getString("hmSerialNo"));
            }
        }
    }
}
